package com.example.lesson002;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//
@RestController
public class DemoController {

    @Autowired
    private Person person;//null

    @RequestMapping("/hello")
    public String sayHello()
    {
        return
                String.format("你好,%s,%s",person.getUsername(),person.getEmail());
    }

    @RequestMapping("/goodbye")
    public String sayGoodBye()
    {
        return "";
    }

    @RequestMapping("/add")
    public String add(int x,int y)
    {
        return String.format("%d+%d=%d",x,y,(x+y));
    }

}
